.class public Lcom/esfile/screen/recorder/media/util/w;
.super Ljava/lang/Object;
.source "Poller.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/esfile/screen/recorder/media/util/w$b;
    }
.end annotation


# instance fields
.field private volatile a:Landroid/os/Handler;

.field private volatile b:Landroid/os/Handler;

.field private final c:Landroid/util/SparseArray;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Landroid/util/SparseArray<",
            "Lcom/esfile/screen/recorder/media/util/w$b;",
            ">;"
        }
    .end annotation
.end field

.field private d:Z


# direct methods
.method public constructor <init>()V
    .locals 1

    .line 1
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 2
    new-instance v0, Landroid/util/SparseArray;

    invoke-direct {v0}, Landroid/util/SparseArray;-><init>()V

    iput-object v0, p0, Lcom/esfile/screen/recorder/media/util/w;->c:Landroid/util/SparseArray;

    const/4 v0, 0x0

    .line 3
    iput-boolean v0, p0, Lcom/esfile/screen/recorder/media/util/w;->d:Z

    return-void
.end method

.method private a(Landroid/os/Looper;)Landroid/os/Handler;
    .locals 1
    .annotation build Landroid/annotation/SuppressLint;
        value = {
            "HandlerLeak"
        }
    .end annotation

    .line 12
    new-instance v0, Lcom/esfile/screen/recorder/media/util/w$a;

    invoke-direct {v0, p0, p1}, Lcom/esfile/screen/recorder/media/util/w$a;-><init>(Lcom/esfile/screen/recorder/media/util/w;Landroid/os/Looper;)V

    return-object v0
.end method

.method private declared-synchronized a(Z)Landroid/os/Handler;
    .locals 1

    monitor-enter p0

    if-eqz p1, :cond_1

    .line 2
    :try_start_0
    iget-object p1, p0, Lcom/esfile/screen/recorder/media/util/w;->b:Landroid/os/Handler;

    if-nez p1, :cond_0

    .line 3
    invoke-static {}, Landroid/os/Looper;->getMainLooper()Landroid/os/Looper;

    move-result-object p1

    .line 4
    invoke-direct {p0, p1}, Lcom/esfile/screen/recorder/media/util/w;->a(Landroid/os/Looper;)Landroid/os/Handler;

    move-result-object p1

    iput-object p1, p0, Lcom/esfile/screen/recorder/media/util/w;->b:Landroid/os/Handler;

    .line 5
    :cond_0
    iget-object p1, p0, Lcom/esfile/screen/recorder/media/util/w;->b:Landroid/os/Handler;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    monitor-exit p0

    return-object p1

    .line 6
    :cond_1
    :try_start_1
    iget-object p1, p0, Lcom/esfile/screen/recorder/media/util/w;->a:Landroid/os/Handler;

    if-nez p1, :cond_2

    .line 7
    new-instance p1, Landroid/os/HandlerThread;

    const-string v0, "Poller"

    invoke-direct {p1, v0}, Landroid/os/HandlerThread;-><init>(Ljava/lang/String;)V

    .line 8
    invoke-virtual {p1}, Landroid/os/HandlerThread;->start()V

    .line 9
    invoke-virtual {p1}, Landroid/os/HandlerThread;->getLooper()Landroid/os/Looper;

    move-result-object p1

    .line 10
    invoke-direct {p0, p1}, Lcom/esfile/screen/recorder/media/util/w;->a(Landroid/os/Looper;)Landroid/os/Handler;

    move-result-object p1

    iput-object p1, p0, Lcom/esfile/screen/recorder/media/util/w;->a:Landroid/os/Handler;

    .line 11
    :cond_2
    iget-object p1, p0, Lcom/esfile/screen/recorder/media/util/w;->a:Landroid/os/Handler;
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    monitor-exit p0

    return-object p1

    :catchall_0
    move-exception p1

    monitor-exit p0

    throw p1
.end method

.method static synthetic a(Lcom/esfile/screen/recorder/media/util/w;)Landroid/util/SparseArray;
    .locals 0

    .line 1
    iget-object p0, p0, Lcom/esfile/screen/recorder/media/util/w;->c:Landroid/util/SparseArray;

    return-object p0
.end method


# virtual methods
.method public a(Lcom/esfile/screen/recorder/media/util/w$b;)V
    .locals 1

    const/4 v0, 0x1

    .line 13
    invoke-virtual {p0, p1, v0, v0}, Lcom/esfile/screen/recorder/media/util/w;->a(Lcom/esfile/screen/recorder/media/util/w$b;ZZ)V

    return-void
.end method

.method public a(Lcom/esfile/screen/recorder/media/util/w$b;Z)V
    .locals 1

    if-eqz p1, :cond_1

    .line 26
    iget-boolean v0, p0, Lcom/esfile/screen/recorder/media/util/w;->d:Z

    if-eqz v0, :cond_0

    goto :goto_0

    .line 27
    :cond_0
    invoke-direct {p0, p2}, Lcom/esfile/screen/recorder/media/util/w;->a(Z)Landroid/os/Handler;

    move-result-object p2

    .line 28
    invoke-static {p1}, Lcom/esfile/screen/recorder/media/util/w$b;->b(Lcom/esfile/screen/recorder/media/util/w$b;)I

    move-result v0

    invoke-virtual {p2, v0}, Landroid/os/Handler;->removeMessages(I)V

    .line 29
    iget-object p2, p0, Lcom/esfile/screen/recorder/media/util/w;->c:Landroid/util/SparseArray;

    monitor-enter p2

    .line 30
    :try_start_0
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/util/w;->c:Landroid/util/SparseArray;

    invoke-static {p1}, Lcom/esfile/screen/recorder/media/util/w$b;->b(Lcom/esfile/screen/recorder/media/util/w$b;)I

    move-result p1

    invoke-virtual {v0, p1}, Landroid/util/SparseArray;->remove(I)V

    .line 31
    monitor-exit p2

    return-void

    :catchall_0
    move-exception p1

    monitor-exit p2
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw p1

    :cond_1
    :goto_0
    return-void
.end method

.method public a(Lcom/esfile/screen/recorder/media/util/w$b;ZZ)V
    .locals 3

    if-eqz p1, :cond_2

    .line 14
    iget-boolean v0, p0, Lcom/esfile/screen/recorder/media/util/w;->d:Z

    if-eqz v0, :cond_0

    goto :goto_1

    .line 15
    :cond_0
    invoke-direct {p0, p2}, Lcom/esfile/screen/recorder/media/util/w;->a(Z)Landroid/os/Handler;

    move-result-object p2

    .line 16
    iget-object v0, p0, Lcom/esfile/screen/recorder/media/util/w;->c:Landroid/util/SparseArray;

    monitor-enter v0

    .line 17
    :try_start_0
    iget-object v1, p0, Lcom/esfile/screen/recorder/media/util/w;->c:Landroid/util/SparseArray;

    invoke-static {p1}, Lcom/esfile/screen/recorder/media/util/w$b;->b(Lcom/esfile/screen/recorder/media/util/w$b;)I

    move-result v2

    invoke-virtual {v1, v2, p1}, Landroid/util/SparseArray;->put(ILjava/lang/Object;)V

    .line 18
    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 19
    invoke-static {p1}, Lcom/esfile/screen/recorder/media/util/w$b;->b(Lcom/esfile/screen/recorder/media/util/w$b;)I

    move-result v0

    invoke-virtual {p2, v0}, Landroid/os/Handler;->removeMessages(I)V

    .line 20
    invoke-static {}, Landroid/os/Message;->obtain()Landroid/os/Message;

    move-result-object v0

    .line 21
    invoke-static {p1}, Lcom/esfile/screen/recorder/media/util/w$b;->b(Lcom/esfile/screen/recorder/media/util/w$b;)I

    move-result v1

    iput v1, v0, Landroid/os/Message;->what:I

    .line 22
    invoke-static {p1}, Lcom/esfile/screen/recorder/media/util/w$b;->c(Lcom/esfile/screen/recorder/media/util/w$b;)Ljava/lang/Object;

    move-result-object v1

    iput-object v1, v0, Landroid/os/Message;->obj:Ljava/lang/Object;

    if-eqz p3, :cond_1

    .line 23
    invoke-static {p1}, Lcom/esfile/screen/recorder/media/util/w$b;->a(Lcom/esfile/screen/recorder/media/util/w$b;)J

    move-result-wide v1

    invoke-virtual {p2, v0, v1, v2}, Landroid/os/Handler;->sendMessageDelayed(Landroid/os/Message;J)Z

    goto :goto_0

    .line 24
    :cond_1
    invoke-virtual {p2, v0}, Landroid/os/Handler;->sendMessage(Landroid/os/Message;)Z

    :goto_0
    return-void

    :catchall_0
    move-exception p1

    .line 25
    :try_start_1
    monitor-exit v0
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    throw p1

    :cond_2
    :goto_1
    return-void
.end method

.method public b(Lcom/esfile/screen/recorder/media/util/w$b;)V
    .locals 1

    const/4 v0, 0x1

    .line 1
    invoke-virtual {p0, p1, v0}, Lcom/esfile/screen/recorder/media/util/w;->a(Lcom/esfile/screen/recorder/media/util/w$b;Z)V

    return-void
.end method
